Mobile: Fixes #10130: Improve note editor performance when quickly entering text #10134
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This fixes #10130 by decreasing the frequency at which
Note.tsx
updatesstate.note
based on editor events.Explanation
Previously, the rerender caused by updating
note.body
could take longer than the time between body updates (for example, on my tablet, when entering text with an external keyboard). This seems to have caused events to queue while waiting for rendering to complete.Logging just before changing the content of
note.body
reveals that state can be set several seconds after actually typing the text. (See the description of #10130). As a result, this may also fix issues raised related to the last edit not being saved (e.g. if the user closes the app beforeNote.tsx
works through the backlog of update events).Screen recordings
Before
before.mp4
Note: The "toggle overflow" button is clicked at roughly 11s. It takes about 20s for the overflow menu to be shown.
After
out.mp4
Testing
adb shell input text
)This has been tested successfully on an Android 12 emulator.